package com.liu.demo.prository;

import com.liu.demo.pojo.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface TeacherPrository extends JpaRepository<Teacher, Integer> {

//    按学工号查询
    public Teacher findByTno(String Tno);

    //    按学工号删除
    @Modifying
    @Transactional
    public int deleteByTno(String Tno);

    // 查找学工号最大的教职工
    @Query(nativeQuery = true,value = "select * from teacher where Tno = (select max(Tno) from teacher)")
    public Teacher findMaxTno();

}
